package com.doraemon.mapper;

import com.doraemon.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 菜品口味管理Mapper
 **/
@Mapper
public interface DishFlavorMapper {

    /***
     * 根据菜品口味集合批量插入 口味 数据
     * ---
     * @param dishFlavors 口味集合
     * @return: void
     */
    void insertBatch(List<DishFlavor> dishFlavors);

    /***
     * 根据 菜品id 删除口味数据
     * ---
     * @param id 菜品id
     * @return: void
     */
    @Delete("delete from dish_flavor where dish_id = #{dishId}")
    void deleteByDishId(Long id);

    /***
     * 根据 菜品id 获取口味数据集合
     * ---
     * @param id 菜品id
     * @return: java.util.List<com.doraemon.entity.DishFlavor> 口味数据集合
     */
    @Select("select * from dish_flavor where dish_id = #{id}")
    List<DishFlavor> getListByDishId(Long id);
}
